/*
 * @Author: bankeyu-dell 573569790@qq.com
 * @Date: 2022-10-08 15:53:59
 * @LastEditors: bankeyu-dell 573569790@qq.com
 * @LastEditTime: 2022-10-12 20:19:49
 * @FilePath: \fast-vue3\src\api\user\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// 权限问题后期增加
import { get, post } from '/@/utils/http/axios';
import { UserState } from '/@/store/modules/user/types';
// import axios from 'axios';
enum URL {
  login = '/user/login',
  logout = '/user/logout',
  profile = '/user/profile',
  indexInfos = '/api/v1/index-infos',
}
interface LoginRes {
  token: string;
}

export interface LoginData {
  username: string;
  password: string;
}

const getUserProfile = async () => get<UserState>({ url: URL.profile });
const login = async (data: LoginData) => post<any>({ url: URL.login, data });
const logout = async () => post<LoginRes>({ url: URL.logout });
const getIndexInfos = async () => get<any>({ url: URL.indexInfos });
export { getUserProfile, logout, login, getIndexInfos };
